---
feature_name: Web Bluetooth / Device Disconnect (Async Await)
chrome_version: 55
check_min_version: true
feature_id: 5264933985976320
icon_url: icon.png
index: index.html
---

{% include_relative _includes/intro.html %}

<p>This sample illustrates the use of the Web Bluetooth API to <a
href="http://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothgattremoteserver-disconnect">disconnect</a>
and get notified from a disconnection of a nearby Bluetooth Low Energy Device
after connecting to it. You may want to check out the <a
href="device-disconnect.html">Device Disconnect (Promises)</a> sample.</p>

<form>
  <input id="service" type="text" list="services" autofocus placeholder="Bluetooth Service">
  <input id="name" type="text" placeholder="Device Name">
  <input id="namePrefix" type="text" placeholder="Device Name Prefix">
  <button id="scan">Scan</button>
  <button id="disconnect">Disconnect</button>
  <button id="reconnect">Reconnect</button>
</form>

{% include_relative _includes/datalist-services.html %}

{% include output_helper.html %}

{% include js_snippet.html filename='device-disconnect-async-await.js' %}

<script>
  document.querySelector('#scan').addEventListener('click', function(event) {
    event.stopPropagation();
    event.preventDefault();

    if (isWebBluetoothEnabled()) {
      ChromeSamples.clearLog();
      onScanButtonClick();
    }
  });
  document.querySelector('#disconnect').addEventListener('click', function(event) {
    event.stopPropagation();
    event.preventDefault();

    if (isWebBluetoothEnabled()) {
      onDisconnectButtonClick();
    }
  });
  document.querySelector('#reconnect').addEventListener('click', function(event) {
    event.stopPropagation();
    event.preventDefault();

    if (isWebBluetoothEnabled()) {
      onReconnectButtonClick();
    }
  });
</script>

{% include_relative _includes/utils.html %}
